package 笔试.奇安信;

import java.util.Arrays;
import java.util.Scanner;

public class Demo4 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(); //烽火台数
        int m = sc.nextInt(); //将军数
        int x = sc.nextInt(); //将军影响范围
        int k = sc.nextInt(); //每个将军提高的战斗力
        int[] nums = new int[n]; //每个烽火台的兵力
        for (int i = 0; i < n; i++) {
            nums[i] = sc.nextInt();
        }
        int[] res = new int[n];
        // 判断（m+1）*x+m==n?
        for (int i = 0; i < n; i++) {

//            for (int j = 0; j <= k; j++) {
//                res[i] = nums[i] + k;
//            }
//            for (int j = k+1; j <= 2*k+1 ; j++) {
//
//            }
        }
        Arrays.sort(nums);


        int min = Integer.MAX_VALUE;
        for(int t:res){
            min = Math.min(t,min);
        }
        System.out.println(nums[0]+2*k);


    }
}
